//全局api配置
/**
 * hrisApis
 * @returns 
 */
const hrisApis = () => [
  {
    name: "LoginApi",
    urls: [
      {
        name: "loginUrl",
        loginUrl: "/itf/permission/web/login",
        methods: "post",
        kind: "data",
      },
    ],
  },
  ,
  {
    name: "staffApi",
    urls: [
      {
        name: "/itf/employee/web/employee",
        staffUrl: "/itf/employee/web/employee",
        methods: "get",
        kind: "params",
      },
      {
        name: "/itf/employee/web/employee/page",
        staffUrl: "/itf/employee/web/employee/page",
        methods: "get",
        kind: "params",
      }, //分页查
      {
        name: "/itf/employee/web/employee/uuid",
        staffUrl: "/itf/employee/web/employee/uuid",
        methods: "get",
        kind: "params",
      }, //根据uuid查员工详情
      {
        name: "/itf/organization/web/enterprise",
        staffUrl: "/itf/organization/web/enterprise",
        methods: "get",
        kind: "params",
      }, //查公司
      {
        name: "/itf/organization/web/custom/field",
        staffUrl: "/itf/organization/web/custom/field",
        methods: "get",
        kind: "params",
      }, //自定义查询
      {
        name: "/itf/organization/web/custom/field/uuid",
        staffUrl: "/itf/organization/web/custom/field/uuid",
        methods: "get",
        kind: "params",
      }, //自定义根据uuid
      {
        name: "/itf/organization/web/dict/info",
        staffUrl: "/itf/organization/web/custom/dict/info",
        methods: "get",
        kind: "params",
      }, //字典查询
      {
        name: "/itf/organization/web/dict/info/uuid",
        staffUrl: "/itf/organization/web/custom/dict/info/uuid",
        methods: "get",
        kind: "params",
      }, //字典by uuid查询
      {
        name: "/itf/organization/web/dict/data",
        staffUrl: "/itf/organization/web/custom/dict/data",
        methods: "get",
        kind: "params",
      }, //字典数据by dictInfoId查询
      {
        name: "/itf/organization/web/dict/data/uuid",
        staffUrl: "/itf/organization/web/custom/dict/data/uuid",
        methods: "get",
        kind: "params",
      }, //字典数据by uuid更新
      {
        name: "/itf/organization/web/dict/data/batch",
        staffUrl: "/itf/organization/web/custom/dict/data/batch",
        methods: "get",
        kind: "params",
      }, //字典数据by id更新
    ],
  },
  {
    name: "selectApis",
    urls: [
      {
        name: "/itf/general/web/dict/data",
        selectApis: "/itf/general/web/dict/data",
        methods: "get",
        kind: "data",
      },
      {
        name: "/itf/general/web/",
        selectApis: "/itf/general/web/",
        methods: "get",
        kind: "data",
      },
    ],
  },
  {
    name: "workInfo",
    urls: [
      {
        name: "/itf/employee/web/work_info",
        selectApis: "/itf/employee/web/work_info",
        methods: "get",
        kind: "data",
      }, //员工工作信息查询
      {
        name: "/itf/employee/web/work_info/uuid",
        selectApis: "/itf/employee/web/work_info/uuid",
        methods: "get",
        kind: "data",
      },
      {
        name: "/itf/employee/web/position/assignment/uuid",
        selectApis: "/itf/employee/web/position/assignment/uuid/",
        methods: "get",
        kind: "data",
      },
      {
        name: "/itf/employee/web/position/assignment",
        selectApis: "/itf/employee/web/position/assignment",
        methods: "post",
        kind: "data",
      },
    ],
  },
  {
    name: "position",
    urls: [
      {
        name: "/itf/organization/web/position",
        selectApis: "/itf/organization/web/position",
        methods: "get",
        kind: "data",
      },
    ],
  },
];

/**
 * 查找所用的apis
 * @param prefixName 使用的api前缀
 * @param nameUrl 对应api名称
 * @returns 
 */
export const findUrl = (prefixName: any, nameUrl: any) => {
  const resUrl: any = hrisApis().filter((v: any) => v.name === prefixName)[0];
  if (!resUrl) {
    // consoleerror('全局url名称找不到，请检查是否加进全局中', !resUrl)
    return;
  }
  const url = resUrl.urls.filter((r: any) => r.name === nameUrl)[0]
  return url
}